package com.javaee.xiangyang.util;

import org.springframework.core.convert.converter.Converter;

import java.text.SimpleDateFormat;
import java.util.Date;

public class DataConverterUtil implements Converter<Date, String> {

    private String parse;

    @Override
    public String convert(Date source) {
        //将日期对象转换成日期的字符串  返回即可
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        parse = format.format(source);
        return parse;
    }
}
